package com.gxa.retail_admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.modules.service.StageMemberService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 工作台会员系统
 */
@Controller
@RequestMapping("/staging/member")
@Api(value = "门店会员信息",tags = "工作台会员系统查询-陈峰江")
public class StageMemberController {
    @Autowired(required = false)
    private StageMemberService stageMemberService;

    /**
     * 按门店会员查询
     * @param sh_name
     * @return
     */
    @ApiOperation(value = "门店会员查询",notes = "门店会员信息",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sh_name",value = "店铺名称",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "page",value = "页数默认1",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "pageSize",value = "条数默认10",paramType = "query",dataType = "String"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code = 400,message = "参数接口错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @GetMapping("/findMemberByName")
    @ResponseBody
    @RequiresPermissions("会员查询")
    public JsonResult findMemberByName(@RequestParam(defaultValue = "1")Integer page , @RequestParam(defaultValue = "10")Integer pageSize,String sh_name){
           return  stageMemberService.findMemberByName(page,pageSize,sh_name);
        }

    /**
     * 按门店挂账查询
     * @param sh_name
     * @return
     */
    @ApiOperation(value = "挂账查询",notes = "门店挂账查询",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sh_name",value = "店铺名称",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "page",value = "页数默认1",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "pageSize",value = "条数默认10",paramType = "query",dataType = "String"),
    })
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code = 400,message = "参数接口错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @GetMapping("/findAccountByName")
    @ResponseBody
    @RequiresPermissions("挂账列表")
    public JsonResult findAccountByName(@RequestParam(defaultValue = "1")Integer page , @RequestParam(defaultValue = "10")Integer pageSize,String sh_name){
            return stageMemberService.findAccountByName(page,pageSize,sh_name);
    }

}

